package com.wholesale.beans;

import org.json.JSONException;
import org.json.JSONObject;

public class LoginResponse {

	private String requestId;
	private int returnType;
	private int userId;
	private String userName;
	private String userToken;
	private JSONObject jsonObject;

	// added by dave
	// 新增用户权限等级
	private String userLevel;
	private int discount;

	public String getUserLevel() {
		return userLevel;
	}

	public void setUserLevel(String userLevel) {
		this.userLevel = userLevel;
	}

	public int getDiscount() {
		return discount;
	}

	public void setDiscount(int discount) {
		this.discount = discount;
	}

	public String getRequestId() {

		return requestId;
	}

	public void setRequestId(String requestId) {
		this.requestId = requestId;
	}

	public int getReturnType() {

		return returnType;
	}

	public void setReturnType(int returnType) {
		this.returnType = returnType;
	}

	public int getUserId() {

		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public String getUserName() {

		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserToken() {

		return userToken;
	}

	public void setUserToken(String userToken) {
		this.userToken = userToken;
	}

	public void jsonAnalytic(String jsonString) {

		try {
			jsonObject = new JSONObject(jsonString);
			jsonAnalytic(jsonObject);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void jsonAnalytic(JSONObject jsonObject) {
		this.jsonObject = jsonObject;

		try {
			requestId = jsonObject.getString("requestId");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			userId = jsonObject.getInt("userId");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			returnType = jsonObject.getInt("returnType");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			userName = jsonObject.getString("userName");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			userToken = jsonObject.getString("userToken");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			userLevel = jsonObject.getString("userLevel");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			discount = jsonObject.getInt("discount");
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}
}
